<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>修改头像</title>


    <meta name="viewport" content="width=device-width"/>
    <meta name="viewport" content="initial-scale=1.0,user-scalable=no"/>
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name = "format-detection" content = "telephone=no">


    <meta name="keywords" content="index">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <meta name="apple-mobile-web-app-title" content="Amaze UI" />
    <link rel="stylesheet" href="css/amazeui.min.css" />
    <link rel="stylesheet" href="css/app.css">
    
    <link type="text/css" href="css/css.css" rel="stylesheet" />


 <script type="text/javascript">  
    //iOS Web APP中点击链接跳转到Safari 浏览器新标签页的问题 devework.com  
    //stanislav.it/how-to-prevent-ios-standalone-mode-web-apps-from-opening-links-in-safari  
    if(("standalone" in window.navigator) && window.navigator.standalone){  
        var noddy, remotes = false;  
        document.addEventListener('click', function(event) {  
            noddy = event.target;
            while(noddy.nodeName !== "A" && noddy.nodeName !== "HTML") {  
                noddy = noddy.parentNode;  
            }  
            if('href' in noddy && noddy.href.indexOf('http') !== -1 && (noddy.href.indexOf(document.location.host) !== -1 || remotes))  
            {  
                event.preventDefault();  
                document.location.href = noddy.href;  
            }  
        },false);  
    }  
  </script> 

</head>
<body>
<!--网页头部栏-->
    <div class="header">
    <table width="100%" border="0" cellspacing="0" class="header_nav">
        <tr>
            <td width="10%" class="nav_left1"><a  href='javascript:window.history.go(-1)'><</a></td>
            <td width="80%" class="nav_title">修改头像</td>
            <td width="10%" class="nav_r"></td>
        </tr>
    </table>
    </div>

<!--头像修改-->
    <div class="classmain">
	<br><br>
    	<table width="100%" border="0" >
    	<tr>
        	<td width="80" class="foot"><img src="img/gundong1.jpg" width="300" height="300"/></a></td>
    </table>
    </div>



    <div class="am-form-group am-form-file">
        <div id="dd" class="tpl-form-file-img"></div>
        <center>  
        	<button type="button" class="am-btn am-btn-danger am-btn-sm">修改头像</button>
        	<input type="file" multiple id="changeicon"/>
        </center>  
    </div>

<!--网页底部栏-->
<div>
    <table width="100%" border="0" cellspacing="0" class="nav">
        <tr>
            <td width="25" class="foot"><a href="index.html"><img src="img/function.png" width="20%" height="auto"/><p>分类</p></a></td>
            <td width="25" class="foot"><a href="addgoods.html"><img src="img/addgoods.png" width="20%" height="auto"/><p>发布</p></a></td> 
            <td width="25" class="foot"><a href="shopcard.html"><img src="img/shopcard.png" width="20%" height="auto"/><p>购物车</p></a></td>
            <td width="25" class="foot"><a href="member.html"><img src="img/myself.png" width="20%" height="auto"/><p>我的</p></a></td>
        </tr>
    </table>
</div>

<script>
    var fil;
    $(document).ready(function () {
    $("#changeicon").change(function () {
    fil = this.files;
    reads(fil[0]);
    });
    });
    function reads(fil){
    var reader = new FileReader();
    reader.readAsDataURL(fil);
    reader.onload = function()
    {
    document.getElementById("dd").innerHTML += "<img src='"+reader.result+"'>";
    };
    }
    var film=fil[0]
    //上传   以下代码在上图片阶段应该没有什么
    function testGetUser(){
      $.ajax({
            url: "/MyStore/AddProdServlet",
            type: 'POST',
            dataType: 'json',
            data: {
                name:$("#name").val,
                price:$("#price").val,
                imgurl:film,
                stoke:$("#stoke").val,
                typeid:$("#typeid").val,
                description:$("#miaoshu").val
            },
            success: function(data,status,xhr) {
              alert('success');
              
              
            },
            error: function(data) {
                console.log(JSON.parse(data.responseText).Error);
                alert(JSON.parse(data.responseText).Error)
            }
        });
    }
</script>
</body>
</html>